<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>精确判断数据类型</title>
</head>
<body>
<script>
    var myDate = new Date();

    var names=["aa","bb","cc","dd"];
    var p =123;
    var result = isDate(names);
    alert(result)
    function isArray(obj) {
        var res=
        obj.constructor.toString().indexOf("Array")>0;
        return res;

    }
    function isDate(date){
        var res = date.constructor.toString().indexOf("Date")>0;
        return res;
    }
</script>

</body>
</html>